<?php /*a:3:{s:83:"D:\phpstudy_pro\WWW\www.xnadmin.site\app\admin\view\data_content_compose\index.html";i:1619158532;s:61:"D:\phpstudy_pro\WWW\www.xnadmin.site\app\admin\view\main.html";i:1588058566;s:67:"D:\phpstudy_pro\WWW\www.xnadmin.site\app\admin\view\breadcrumb.html";i:1588058566;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title><?php echo xn_cfg('base.sys_name'); ?></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <script>
        //全局上传文件端口
        var UPLOAD_FILE_URL = "<?php echo url('upload_files/upload'); ?>";
        //全局选择文件端口
        var SELECT_FILE_URL = "<?php echo url('upload_files/select'); ?>";
    </script>
    <script src="/static/admin/js/jquery-2.0.0.min.js"></script>
    <script src="/static/admin/js/common.js"></script>
    <script src="/static/admin/js/upload.js"></script>
    <script src="/static/admin/js/webuploader.min.js"></script>
    <link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/admin/style/layuiAdmin.css" media="all">
    <link rel="stylesheet" href="/static/admin/style/base.css" media="all">
    
</head>
<body>

<?php if(!empty($breadcrumb)): ?>
<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
        <a href="<?php echo url('admin/index/home'); ?>">主页</a>
        <?php if(is_array($breadcrumb) || $breadcrumb instanceof \think\Collection || $breadcrumb instanceof \think\Paginator): if( count($breadcrumb)==0 ) : echo "" ;else: foreach($breadcrumb as $key=>$vo): ?>
        <a><cite><?php echo htmlentities($vo['title']); ?></cite></a>
        <?php endforeach; endif; else: echo "" ;endif; ?>
    </div>
</div>
<?php endif; ?>
<div class="layui-fluid">
    <div class="layui-card">
        <div class=" layui-card-header layuiadmin-card-header-auto">
            <form class="layui-form" method="get">
                <input type="hidden" name="bcid" value="<?php echo input('bcid'); ?>"><!--保留当前位置的bcid参数-->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-btn-group">
                            <a href="<?php echo url('add'); ?>" data-width="800px" data-height="650px" class="layui-btn xn_open" title="添加">
                                添加
                            </a>
                            <button type="button" class="layui-btn layui-btn-normal" id="file">导入</button>
                            <input class="layui-upload-file" type="file" accept="" name="file">
                            <a href="javascript:;" title="确认要删除吗？" class="layui-btn layui-btn-danger" id="deleteAll">
                                删除
                            </a>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: 100px;">总计：<?php echo htmlentities($count); ?></label>
                        <div class="layui-input-inline" style="width: 150px;">
                            <select name="parent_typeid" lay-filter="parent_typeid">
                                <option value="0">请选择</option>
                                <?php if(is_array($parent_typelist) || $parent_typelist instanceof \think\Collection || $parent_typelist instanceof \think\Paginator): if( count($parent_typelist)==0 ) : echo "" ;else: foreach($parent_typelist as $key=>$vo): ?>
                                <option value="<?php echo htmlentities($vo['id']); ?>" <?php if($param['parent_typeid']==$vo['id']): ?>selected<?php endif; ?>><?php echo htmlentities($vo['title']); ?></option>
                                <?php endforeach; endif; else: echo "" ;endif; ?>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline" style="width: 150px;">
                            <select name="typeid" id="typeid">
                                <option value="0">请选择</option>
                                <?php if(is_array($typelist) || $typelist instanceof \think\Collection || $typelist instanceof \think\Paginator): if( count($typelist)==0 ) : echo "" ;else: foreach($typelist as $key=>$vo): ?>
                                <option value="<?php echo htmlentities($vo['id']); ?>" <?php if($param['typeid']==$vo['id']): ?>selected<?php endif; ?>><?php echo htmlentities($vo['title']); ?></option>
                                <?php endforeach; endif; else: echo "" ;endif; ?>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline">
                            <input type="text" name="kw" class="layui-input" value="<?php echo htmlentities($param['kw']); ?>">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                        </button>
                    </div>
                </div>
            </form>
        </div>
        <div class="layui-card-body">
            <table class="layui-table">
                <tr>
                    <th><b><input type="checkbox" id="selectAll"></b></th>
                    <th><b>ID</b></th>
                    <th><b>标题</b></th>
                    <th><b>大类</b></th>
                    <th><b>小类</b></th>
                    <th><b>项目</b></th>
                    <th><b>时间</b></th>
                    <th><b>操作</b></th>
                </tr>

                <tbody>
                <?php if(is_array($list) || $list instanceof \think\Collection || $list instanceof \think\Paginator): if( count($list)==0 ) : echo "" ;else: foreach($list as $key=>$vo): ?>
                <tr>
                    <td><input type="checkbox" name="ids[]" value="<?php echo htmlentities($vo['id']); ?>" class="checkids"></td>
                    <td><?php echo htmlentities($vo['id']); ?></td>
                    <td><?php echo htmlentities($vo['title']); ?></td>
                    <td><?php echo htmlentities(get_typename($vo['parent_typeid'])); ?></td>
                    <td><?php echo htmlentities(get_typename($vo['typeid'])); ?></td>
                    <td><?php echo htmlentities($vo['project']); ?></td>
                    <td><?php echo htmlentities($vo['create_time']); ?></td>
                    <td>
                        <a href="<?php echo url('edit',array('id'=>$vo['id'])); ?>" data-width="800px" data-height="650px" title="编辑" class="layui-btn layui-btn-normal layui-btn-xs xn_open">
                            <i class="layui-icon layui-icon-edit"></i>编辑
                        </a>
                        <a href="<?php echo Url('delete',array('id'=>$vo['id'])); ?>" title="确认要删除吗？" class="layui-btn layui-btn-danger layui-btn-xs xn_delete">
                            <i class="layui-icon layui-icon-delete"></i>删除
                        </a>
                    </td>
                </tr>
                <?php endforeach; endif; else: echo "" ;endif; ?>
                </tbody>
            </table>
        </div>
    </div>
    <div class="pages">
        <?php echo $list; ?>
    </div>
</div>


<script src="/static/admin/layui/layui.all.js"></script>
<script src="/static/admin/js/admin.js"></script>

<script>
    var upload = layui.upload;
    upload.render({
        elem: '#file'
        ,url: "<?php echo url('import'); ?>" //改成您自己的上传接口
        ,accept: 'file' //普通文件
        ,exts: 'xlsx|xls' 
        ,done: function(res){
            layer.msg(res.msg,{time:2000},function(){
                window.location.reload();
            });
        }
        ,error: function(){
            layer.msg('请求失败');
        }
    });
    
    $(function() {
        var $selectAll = $("#selectAll");
        $selectAll.click(function() {
            if ($selectAll.prop("checked") == true) {
                $('.checkids').prop("checked", true);
            } else {
                $('.checkids').prop("checked", false);
            }
        });

        $("#deleteAll").click(function(){
            layer.confirm('确认删除选定内容吗?', {icon: 3, title:'操作提示'}, function(index){
                var ids = [];
                $('.checkids:checked').each(function(index,obj){
                    ids.push(obj.value);
                });
                $.get("<?php echo Url('deleteAll'); ?>?ids="+ids,function(data){
                    layer.msg(data.msg, {
                    time: 1000 
                    }, function(){
                    location.reload();
                    }); 
                });
            });
        });


    });



    var form = layui.form;
    form.on('select(parent_typeid)', function(res) { 
        $("#typeid").empty();
        if(res.value != 0){
            $.get("<?php echo url('admin/DataType/getSonType'); ?>?pid="+res.value,function(result){
                if(result.status){
                    $("#typeid").append(new Option('请选择',0));
                    $.each(result.data,function(index,item){
                        $("#typeid").append(new Option(item.title,item.id));
                    });
                    form.render("select");
                }
            });
        }else{
            $("#typeid").append(new Option('请选择',0));
            form.render("select");
        }
    })

</script>

</body>
</html>